package com.atguigu.prototype.improve;

public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        Sheep sheep = new Sheep("tom", 1, "白色");
        Sheep friend = new Sheep("jack", 2, "黑色");
        sheep.setFriend(friend);

        Sheep sheep2 = (Sheep)sheep.clone();
        Sheep sheep3 = (Sheep)sheep.clone();
        Sheep sheep4 = (Sheep)sheep.clone();
        Sheep sheep5 = (Sheep)sheep.clone();

        System.out.println("sheep2 =" + sheep2 + "sheep2.friend=" + sheep2.getFriend().hashCode());
        System.out.println("sheep3 =" + sheep3 + "sheep3.friend=" + sheep3.getFriend().hashCode());
        System.out.println("sheep4 =" + sheep4 + "sheep4.friend=" + sheep4.getFriend().hashCode());
        System.out.println("sheep5 =" + sheep5 + "sheep5.friend=" + sheep5.getFriend().hashCode());

        System.out.println(sheep == sheep2);
        System.out.println(sheep.equals(sheep2));

        System.out.println(sheep.getFriend() == sheep2.getFriend());
        System.out.println(sheep.getFriend().equals(sheep2.getFriend()));

        friend.setAge(20);
    }
}
